<template>
	<image :class="className" @click="onclick" :src="(src && src.startsWith('http'))?src:(imgUrlPrefix+src)" :mode="mode" :style="`width:${width};height:${height}`"></image>
</template>

<script>
	import {defineComponent,reactive,toRefs,onMounted,getCurrentInstance,computed} from 'vue'
	import {onLoad,onShow} from '@dcloudio/uni-app'
	import { useStore } from 'vuex'
	export default defineComponent({
		components:{
			
		},
		props:{
			src:'',
			mode:{
				type:String,
				default:'aspectFill'
			},
			className:'',
			width:{
				type:String,
				default:'100%'
			},
			height:{
				type:String,
				default:'100%'
			}
		},
		setup(props,context) {
			const store = useStore()
			const {proxy} = getCurrentInstance()
			
			const state = reactive({
				imgUrlPrefix:getApp().globalData.imgUrlPrefix,
			})
			
			onMounted(()=>{
				
			})
			
			const onclick = ()=>{
				proxy.$emit('click')
			}
			
			return {
				...toRefs(state),
				onclick
			}
		}
	})
</script>

<style lang="scss" scoped>
	
</style>
